(function(angular) {
	'report strict';
	angular.module('fs.waf').controller('cda.report.viewController', viewController);
	viewController.$inject = [ '$scope', 'Constants', 'layoutConfig', 'validatorConfig', 'gridService', 'authService', 'reportService' ];
	function viewController($scope, Constants, layoutConfig, validatorConfig, gridService, authService, reportService) {
		var ctrl = this, reportInfo = $scope.$stateParams.params;
		ctrl.report = {};
		ctrl.init = function() {
			ctrl.readOnly = true;
			// init report Parameter
			reportService.initReportParameter($scope, ctrl, layoutConfig);
			// init report company
			reportService.initCompany($scope, ctrl, false, layoutConfig);
			
			ctrl.reportParameterGridOptions.enableRowHeaderSelection = false;
			ctrl.companyGridOptions.enableRowHeaderSelection = false;
			// init report Parameter
			reportService.initDataOptions($scope, ctrl);
			authService.view(reportInfo).then(function(response) {
				ctrl.report = response.data || reportInfo;
				ctrl.report.reportParms = ctrl.report.reportParms || [];
				ctrl.report.companyRpts = ctrl.report.companyRpts || [];
				ctrl.layoutConfig = layoutConfig;
			});
		};
		
	}
})(angular);